package com.bigbee.gyf;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class practice {

	public static void main(String[] args) {
		// 时间string与date的相互转化
		/*String str = "2017年01月20日";
		DateFormat df =  new SimpleDateFormat("yyyy年MM月dd日"); 
		try {
			Date d =df.parse(str);
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			String s = sdf.format(d);
			System.out.println(d); //Fri Jan 20 00:00:00 CST 2017
			System.out.println(s); //2017-01-20
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Long l = (new Date()).getTime();
		System.out.println(l);*/
		//自动拆装箱后数字的比较
		boolean flag;
		flag = Integer.parseInt("1") == 1;
		System.out.println(flag);
		flag = Integer.valueOf("1") == 1;
		System.out.println(flag);
		
		String s = new String("128 ");
		Integer c = Integer.valueOf(s.trim());
		Integer d = Integer.parseInt("128");
		flag = c == d;
		System.out.println("==============="+flag);
		int a = 600;
		int b = Integer.valueOf("600");
		flag = a==b;
		System.out.println(flag);
		
		Integer a2 = Integer.valueOf("256");
		System.out.println(a2.byteValue());
		System.out.println(a2.getClass().hashCode());
		System.out.println(a2.toString());
		Integer b2 = Integer.valueOf((new String("256  ")).trim());
		System.out.println(b2.byteValue());
		System.out.println(b2.getClass().hashCode());
		System.out.println(b2.toString());
		flag = a2 == Integer.valueOf((new String("256  ")).trim());
		System.out.println(flag);
		
		System.out.println("基本类型：int 二进制位数："+Integer.SIZE);
		
		Integer i1 = 127;  
        Integer i2 = 127;  
          
        System.err.println(i1 == i2);  
        i1 = 128;  
        i2 = 128;  
        System.err.println(i1 == i2);
        
        int n = 127;
        Integer m = n;
        int l = m;
        System.out.println(l);
		
	}

}
